import request from '@/config/axios'

// IP访问规则 VO
export interface IpRuleVO {
  id: number // ID
  ruleName: string // 规则名称
  contentLimitIpConfig: string // 文档数据访问IP限制
}

// IP访问规则 API
export const IpRuleApi = {
  // 查询IP访问规则分页
  getIpRulePage: async (params: any) => {
    return await request.get({ url: `/cms/ip-rule/page`, params })
  },
  // 查询IP访问规则列表
  getIpRuleList: async (params: any) => {
    return await request.get({ url: `/cms/ip-rule/list`, params })
  },

  // 查询IP访问规则详情
  getIpRule: async (id: number) => {
    return await request.get({ url: `/cms/ip-rule/get?id=` + id })
  },

  // 新增IP访问规则
  createIpRule: async (data: IpRuleVO) => {
    return await request.post({ url: `/cms/ip-rule/create`, data })
  },

  // 修改IP访问规则
  updateIpRule: async (data: IpRuleVO) => {
    return await request.put({ url: `/cms/ip-rule/update`, data })
  },

  // 删除IP访问规则
  deleteIpRule: async (id: number) => {
    return await request.delete({ url: `/cms/ip-rule/delete?id=` + id })
  },

  // 导出IP访问规则 Excel
  exportIpRule: async (params) => {
    return await request.download({ url: `/cms/ip-rule/export-excel`, params })
  },
}
